import qs from 'querystring'
import request from '@/utils/request'
const GET_USER = 'users'
const PUT_SWITCH='users/'
const DEL_SWITCH='users/'
const ADD_USERS = 'users'

function getUser(params){
    return request({
        url:GET_USER + '?' +qs.stringify(params),
        method:'get'
    })
}

function UpdateSwitch(obj){
    return request({
        url:PUT_SWITCH+obj.id+'/'+'state'+'/'+obj.mg_state,
        method:'put'
    })
}

function delUsers(id){
    return request({
        url:DEL_SWITCH+id,
        method:'delete'
    })
}

function addUsers(params){
    return request({
        url:ADD_USERS,
        method:'post',
        data:params
    })
}

function editUsers(id){
    return request({
        url:DEL_SWITCH+id,
        method:'get'
    })
}

function editFromUsers(id,obj){
    return request({
        url:DEL_SWITCH+id,
        method:'put',
        data:obj
    })
}

export {getUser,UpdateSwitch,delUsers,addUsers,editUsers,editFromUsers}